package frontend_package;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;

import javax.swing.border.Border;

/**
 * Class that makes customized button with rounded corners
 * 
 * @author Aidana
 * 
 */
public class RoundedBorder implements Border {
	/** radius integer */
	private int radius;

	/**
	 * Constructor
	 * 
	 * @author Aidana
	 * @param radius
	 */
	public RoundedBorder(int radius) {
		this.radius = radius;
	}

	/**
	 * Gets Borders
	 * 
	 * @author Aidana
	 * @param Component
	 */
	public Insets getBorderInsets(Component c) {
		return new Insets(this.radius + 1, this.radius + 1, this.radius + 2,
				this.radius);
	}

	/**
	 * Is Border opaque
	 * 
	 * @author Aidana
	 * @return true
	 */
	public boolean isBorderOpaque() {
		return true;
	}

	/**
	 * Class that paints the borders of the button
	 * 
	 * @author Aidana
	 */
	public void paintBorder(Component c, Graphics g, int x, int y, int width,
			int height) {
		g.drawRoundRect(x, y, width - 1, height - 1, radius, radius);
	}

}
